import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Index from './pages/Index';
import './App.css';
import './common/utils/i18next';
import { URL_INFO, Login } from '@amcax/base';
declare global {
  interface Window {
    __MICRO_APP_ENVIRONMENT__: any;
  }
}
function App() {
  !window.location.href.includes('/login') &&
    localStorage.setItem(URL_INFO, window.location.href);
  const windows: any = window;
  return (
    <>
      <BrowserRouter basename={windows.__MICRO_APP_BASE_ROUTE__ || '/'}>
        <Switch>
          {!window.__MICRO_APP_ENVIRONMENT__ && (
            <Route
              path='/login'
              component={Login}
            />
          )}
          <Route
            path='/'
            component={Index}
          />
        </Switch>
      </BrowserRouter>
    </>
  );
}

export default App;
